package com.hunliji.monitor.service.impl;

import com.hunliji.monitor.dao.mapper.mt.DbInstanceMapper;
import com.hunliji.monitor.dao.model.dataobject.DbInstanceDO;
import com.hunliji.monitor.service.api.DbInstanceService;
import com.hunliji.monitor.service.api.model.bo.DbInstanceBO;
import com.hunliji.monitor.share.component.ComponentLocator;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * 数据库实例
 * @author wuchen
 */
@Service
public class DbInstanceServiceImpl implements DbInstanceService {
    @Resource
    private DbInstanceMapper dbInstanceMapper;
    @Override
    public DbInstanceBO queryById(Long id) {
        DbInstanceDO dbInstanceDO = dbInstanceMapper.selectById(id);
        if(Objects.isNull(dbInstanceDO)){
            return null;
        }
        return ComponentLocator.getConverter().convert(dbInstanceDO,DbInstanceBO.class);
    }
}
